package canJump55;

public class CanJump {

    public boolean canJump(int[] nums) {
        int max_i = 0;
        for (int i = 0; i < nums.length; i++) {

            if(i>max_i){
                return false;
            }
            //当前元素能走最远下标
            int curr_max = i + nums[i];
            max_i = Math.max(max_i, curr_max);
        }
        return max_i >= nums.length-1;
    }

}
